<template>
	<view class="padding">
		<shopro-empty v-if="data.length==0" :image="$IMG_URL + '/imgs/empty/empty_goods.png'" tipText="暂无列表，敬请期待..."></shopro-empty>
	<view class="" v-else>
		<text class="tt">点击可复制兑换码</text>
		<view class="padding-xs  margin-tb-sm  shadow-blur flex flex-direction bg-gray r10" v-for="(item,index) in data" :key='index'  @click="click(item.code)">
			<text>{{item.code}}</text>
			<view class="flex  justify-between align-center margin-top-xs">
				
				
				<text class="">{{item.createtime}}</text>
				<text style="white-space: nowrap;" v-if="item.status==1">未使用 </text>
				<text style="white-space: nowrap; color: red;" v-else>已使用 </text>
				<!-- 已使用 -->
			</view>
		</view>
	</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data:[]
			}
		},
		onLoad(e) {
			this.name()
		},
		methods: {
			async name(){
				 // lstOfPersonalRedemptionCodes
				 const res = await this.$http('common.lstOfPersonalRedemptionCodes',);
				 this.data  =res.data
				 console.log('res :>> ', res);
			},
			async click(e){
				 uni.setClipboardData({
				     data: e+'',
				     success: function () {
				        // this.$tools.toast('复制成功~~')
				     }
				 });
			},
		}
	}
</script>

<style>
 .tt {
	
	 font-size: 28rpx;
	 font-family: PingFang SC;
	 font-weight: 500;
	 color: #806E47;
	 text-align: center;
	 margin-bottom: 20rpx;
	
 }
 text {
	 font-size: 28rpx;
	 font-family: PingFang SC;
	 font-weight: 500;
	 color: #806E47;
	 
	 margin-top: 20rpx;
 }
</style>
